Home:ALL Converter>How to use -v volumes parameter in docker on Windows Subsystem for Linux

How to use -v volumes parameter in docker on Windows Subsystem for Linux

Ask Time:2018-11-26T07:51:18         Author:user504909

Json Formatter

My windows 10 version is 1803

I install docker fellow the link:

https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

I try to use -v of docker like:

docker run -it -v ~/.aws:root/.aws/ ubuntu

I also try to use:

docker run -it -v $(realpath ~/.aws):/root/.aws ubuntu

But I find the volumes I want to mapping to docker system is not there.

when I do:

ls /root/.aws

there is always empty, how to mapping the data volumes on Windows Subsystem for linux?

Author:user504909,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/53473180/how-to-use-v-volumes-parameter-in-docker-on-windows-subsystem-for-linux
Rich Turner :

Docker for Windows runs atop Windows itself but has no knowledge of WSL.\n\nIn WSL:\n\n\nDistros can see the contents of Windows \"drives\" via the automatically mounted drives under /mnt/<drive-letter>\nWindows currently cannot reach into the filesystems of installed Linux distros. We're working to remedy this in future releases ;)\n\n\nWhile Docker Engine itself cannot run within WSL, you can install Docker for Windows, and operate it from within WSL using the docker command-line tool, specifying the hostname via the -h argument, or export to DOCKER_HOST in your .bashrc. \n\nYou may find some of these tutorials useful:\n\n\n\"Setting Up Docker for Windows and WSL to Work Flawlessly\" by @nickjanetakis\n\"Running Docker containers on Bash on Windows\" by @jayway\n\"Docker in WSL\" by @wizardsoftheweb\n",
2018-11-29T22:45:24
pnocti :

Answer above by Serge works, but I have done away with the cmd.exe part and just enclosed the Windows style path with single quotes.\n\nI have the same issue with Docker for Desktop running inside WSL not reading my ~/.aws folder. My .aws folder is a soft link from C:\\Users\\.aws folder.\n\nThis is what worked for me:\n\ndocker run -v 'C:\\Users\\username\\.aws':/root/.aws linux_image\n",
2019-08-19T08:31:37
yy